table.INDEX_TAG_ADD Function

Syntax

as P = Index_Tag_Add(C Tagname,C Order_expression[,C Filter_expression[,C Index_Type]])

Arguments

Tagname

The name of an existing index or new index that should be created. Any character string, up to 10 characters long, used to identify the index.

Order_expression

A character order expression that sorts selected records.

Filter_expression

Optional. Default = all records. A character filter expression that selects the records to be indexed.

Index_Type

Optional. Default = "" (Ascending, not unique). A string of character flags that can specify a descending sort order (?D'), and or include only records with unique key values (?U').

Description

Add a tag to the production index for the database.

Discussion

The .INDEX_TAG_ADD() method finds an existing index, specified by Tag_Name, in the production index file for a table. If the index does not exist, the method creates it. When called, this function first searches the index file to see if this index already exists. If an index with identical specifications (i.e., the same Order_Expression, Filter_Expression, and Index_Type ) is found, .INDEX_TAG_ADD()returns an object pointer to this index. If the index does not already exist, .INDEX_TAG_ADD()creates the new index tag and adds it to the production index file. It returns an object pointer, , to the new index tag. If no index tags have been previously created for , a new production index file is created. The production index is the index file with the same name as the table name (with a .CDX extension). It is opened automatically when the table is opened.

Example

Add a descending index on the FIRST_NAME field.

dim tbl as P
tbl = table.current()
indx = tbl.index_tag_add("BYNAME", "FIRST_NAME", "", "D")

See Also